package nsoft.util;

public class Property {
	// TODO needs to add property change support.

	Object bean;
	String name;

	public Property(Object bean, String name) {
		super();
		this.bean = bean;
		this.name = name;
	}

	public void setValue(Object value) {
		BeanUtilities.setProperty(bean, name, value);
	}

	public Object getValue() {
		return BeanUtilities.getProperty(bean, name);
	}

	public String getValueAsString() {
		Object val = BeanUtilities.getPropertyD(bean, name);
		return FormatUtil.format((val == null ? "" : val));
	}

	public Object getBean() {
		return bean;
	}

	public void setBean(Object bean) {
		this.bean = bean;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

}
